<?php

class Public_ContactSuccessView extends ITBergaBaseView
{
	public function executeHtml(AgaviRequestDataHolder $rd)
	{
		$this->setupHtml($rd);
		$this->setAttribute('title', $this->getContext()->getTranslationManager()->_('Thank you for your feedback ', 'itberga.layout'));
		$com = $rd->getParameter('rcontact', null);
		
		$str  = "Comentaris: \n\n";
		$str .= "Nom: " . $com['name'] . "\n";
		$str .= "E-mail: " . $com['email'] . "\n";
		$str .= "Assumpte: " . $com['subject'] . "\n";
		$str .= "Comentaris: " . $com['comments'] ;
						
        $email = new PHPMailer();
		$email->From = "info@itberga.com";
		$email->FromName = "Web - ITBerga";
		$email->AddReplyTo('info@itberga.com', 'ITBerga');
//		$email->IsSendmail();
		$email->IsSMTP();
		$email->IsHTML(false);
		$email->SetLanguage($this->getContext()->getTranslationManager()->getCurrentLocale()->getLocaleLanguage());
		$email->ClearAddresses();
		$email->AddAddress("info@itberga.com", "Web - ITBerga");
		$email->Subject = 'Comentaris enviats pel client';
        $email->Body = utf8_decode($str);
        if ($email->Send()) $mstr = array(true, null);
        	  else $mstr = array(false, $email->ErrorInfo);
		$this->setAttribute('mstr', $mstr);
	}
}

?>
